const joi = require('joi')

const phone = joi.string().pattern(/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/).required()
const password  = joi.string().pattern(/^[0-9A-Za-z]{8,20}$/)
const code  = joi.number()
const type = joi.string()
const nickname = joi.string().min(1).max(20).required()
const gender = joi.number().integer().min(0).max(2).required()
const birthday = joi.string().required()
const address = joi.string().required()
const school = joi.string().required()
const signature = joi.string().required()

// 发送验证码数据校验
exports.sendCode = {
  body: {phone}
}

// 登录数据校验
exports.login = {
  body: {phone,password,code,type}
}

// 修改昵称
exports.updateNickname = {
  body: {nickname}
}

// 修改性别
exports.updateGender = {
  body: {gender}
}

// 修改生日
exports.updateBirthday = {
  body: {birthday}
}

// 修改昵称
exports.updateAddress = {
  body: {address}
}

// 修改学校
exports.updateSchool = {
  body: {school}
}

// 修改个人介绍
exports.updateSignature = {
  body: {signature}
}

// 身份验证
exports.verifyID = {
  body: {phone,code}
}

// 设置密码
exports.updatePwd = {
  body: {phone,password}
}

// 更换手机号
exports.updatePhone = {
  body: {phone,code}
}